<form class="form-horizontal" id="form-add-category">
    {if condition="!empty($parent)"}
    <div class="form-group">
        <label class="control-label col-xs-2">上级分类</label>
        <div class="col-xs-9">
            <span class="control-label">{$parent.title}</span>
            <input type="hidden" name="parent_id" value="{$parent.id}">
        </div>
    </div>
    {/if}
    <div class="form-group">
        <label class="control-label col-xs-2">
            分类名称
            <span style="color: #FF0000;">*</span>
        </label>
        <div class="col-xs-9">
            <input type="text" class="form-control" maxlength="10" name="title" placeholder="输入分类名称" autocomplete="off" required>
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-2">分类描述</label>
        <div class="col-xs-9">
            <input type="text" class="form-control" name="desc" placeholder="输入分类描述信息" autocomplete="off"/>
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-2">
            分类图标
            <span style="color: #FF0000;">（宽高相等）</span>
        </label>
        <div class="col-xs-9">
            {include file="public/singleImageUploader" uploader-name="thumb" /}
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-2">分类排序</label>
        <div class="col-xs-9">
            <input type="number" class="form-control" name="order" placeholder="输入分类序号，序号越高，显示越靠前">
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-2">是否显示</label>
        <div class="col-xs-9">
            <div class="btn-group" data-toggle="buttons">
                <label class="btn btn-default active">
                    <input type="radio" name="visible" id="visible_1" value="1" checked> 显示
                </label>
                <label class="btn btn-default ">
                    <input type="radio" name="visible" id="visible_0" value="0" > 隐藏
                </label>
            </div>
        </div>
    </div>

    <div class="form-group">
        <div class="col-xs-offset-2 col-xs-3">
            <button type="submit" class="btn btn-success btn-block">确认添加</button>
        </div>
    </div>
</form>

<script src="__PUBLIC__/vendors/jquery.validation/jquery.validate.min.js"></script>
<script src="__PUBLIC__/vendors/jquery.validation/additional-methods.js"></script>
<script src="__PUBLIC__/vendors/jquery.validation/messages_zh.min.js"></script>
<script type="application/javascript">
    $(function () {
        $("#form-add-category").validate({
            messages:
                {
                    title: "必须填写分类名称"
                },
            debug: true,
            submitHandler: function () {
                ajaxSubmit('form-add-category', true);
            }
        });
    })
</script>